import { createRouter, createWebHashHistory } from 'vue-router'
import Home from '../views/Home.vue'
import Index from '../views/Index.vue'
import Login from '../views/login.vue'
import Goods from '../views/goods.vue'
import Cat from '../views/cat.vue'

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect: '/index',
    children: [
      {
        path: '/index',
        name: 'index',
        component: Index
      },
      {
        path: '/goods/:id',
        name: 'goods',
        component: Goods
      },
      {
        path: '/cart',
        name: 'cat',
        component: Cat
      }
    ]
  }, {
    path: '/login',
    name: 'login',
    component: Login,
  },
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
